import request, { scope } from '../utils/request';

const loginUrl = scope('login');

export const loginByPassword = (phone, password) => {
  return request({
    url: loginUrl(),
    method: 'post',
    data: { phone, password },
  });
};

export const loginByCaptcha = (phone, captcha) => {
  return request({
    url: loginUrl('phone'),
    method: 'post',
    data: { phone, captcha },
  });
};

export const sendCaptcha = (phone) => {
  return request({
    url: loginUrl('sendcode'),
    method: 'post',
    data: { phone },
  });
};
